library(plyr) #用于数据处理包
library(dplyr) #用于数据处理包
library(arsenal) ##用于tableby
library(readr)
library(compareGroups)
library(dplyr)
library(gtsummary)
library(caret)

getwd()
data <-read.csv('post_thrombotic_syndrome.csv')
mydata <-read.csv('post_thrombotic_syndrome.csv')
colname <- colnames(data)
colnameTest <-''
for (variable in colname) {
  print(variable)
  colnames <- paste0(colnameTest,"+",variable)
  
}

#### 临床模型工具箱 下面是基线分析 其实就说可以按照tableby或者gtsummary做 ####

library(caret)
dev = mydata[mydata$s_group==1,]
vad = mydata[mydata$s_group==0,]
#其实这段话就是加个字段在表格里面
train=dev %>% dplyr::mutate(Groupsp="Train")
test=vad %>% dplyr::mutate(Groupsp="Test")

#方法1 
aaa <- tableby( ~ uid+type+x_age+(f_education)+x_sex+x_bmi+x_smoking+x_side_of_dvt_left
                +x_side_of_dvt_bilateral+x_symptom_pain+x_symptom_edema+
                  x_symptom_pain_on_calf_compression+x_ilio_femoral_dvt+
                  x_risk_factors_of_dvt_surgery_and_immobilization+
                  x_risk_factors_of_dvt_fracture+x_risk_factors_of_dvt_active_cancer+
                  x_risk_factors_of_dvt_hyperhomocysteinemia+x_risk_factors_of_dvt_cvi+
                  x_risk_factors_of_dvt_history_of_vte+x_risk_factors_of_dvt_pregnancy+
                  x_risk_factors_of_dvt_thrombophilia+x_risk_factors_of_dvt_chronic_kidney_disease+
                  x_risk_factors_of_dvt_oral_contraceptive+x_risk_factors_of_dvt_family_history_of_dvt+
                  x_risk_factors_of_dvt_unprovoked+x_comorbidity_hypertension+x_comorbidity_pe+
                  x_comorbidity_stroke+x_comorbidity_diabetes+x_comorbidity_coronary_heart_disease+
                  x_comorbidity_immune_rheumatism+x_types_of_anticoagulants_lmwh+x_types_of_anticoagulants_doacs+
                  x_types_of_anticoagulants_vka+x_types_of_anticoagulants_other+
                  x_duration_of_compression_therapy_xiaoyu_6_mon+x_d_dimmer+y_post_thrombotic_syndrome+s_group,data = data,
                numeric.stats=c("mean","q1q3"),total=T)
summary(aaa,text = T)
aaa2 <- tableby( ~ uid+type+x_age+(f_education)+x_sex+x_bmi+x_smoking+x_side_of_dvt_left
                +x_side_of_dvt_bilateral+x_symptom_pain+x_symptom_edema+
                  x_symptom_pain_on_calf_compression+x_ilio_femoral_dvt+
                  x_risk_factors_of_dvt_surgery_and_immobilization+
                  x_risk_factors_of_dvt_fracture+x_risk_factors_of_dvt_active_cancer+
                  x_risk_factors_of_dvt_hyperhomocysteinemia+x_risk_factors_of_dvt_cvi+
                  x_risk_factors_of_dvt_history_of_vte+x_risk_factors_of_dvt_pregnancy+
                  x_risk_factors_of_dvt_thrombophilia+x_risk_factors_of_dvt_chronic_kidney_disease+
                  x_risk_factors_of_dvt_oral_contraceptive+x_risk_factors_of_dvt_family_history_of_dvt+
                  x_risk_factors_of_dvt_unprovoked+x_comorbidity_hypertension+x_comorbidity_pe+
                  x_comorbidity_stroke+x_comorbidity_diabetes+x_comorbidity_coronary_heart_disease+
                  x_comorbidity_immune_rheumatism+x_types_of_anticoagulants_lmwh+x_types_of_anticoagulants_doacs+
                  x_types_of_anticoagulants_vka+x_types_of_anticoagulants_other+
                  x_duration_of_compression_therapy_xiaoyu_6_mon+x_d_dimmer+y_post_thrombotic_syndrome+s_group,data = mydata2,
                numeric.stats=c("mean","q1q3"),total=T)
summary(aaa2,text = T)
which(is.na(data[,'x_d_dimmer']))
dim(data)
meanx_d_dimmer<-sum(data[,'x_d_dimmer']) / dim(data)

#这块跟我手动计算不对 tableby 和 descrTable 计算结果是一样的 都是591 但是手动 625 是因为默认选择错误
mydata2 <- data
mydata2[,c("type", "f_education","x_sex", "x_smoking","x_side_of_dvt_left",
           "x_side_of_dvt_bilateral","x_symptom_pain","x_symptom_edema","x_symptom_pain_on_calf_compression",
           "x_ilio_femoral_dvt","x_risk_factors_of_dvt_surgery_and_immobilization",
           "x_risk_factors_of_dvt_fracture","x_risk_factors_of_dvt_active_cancer",
           "x_risk_factors_of_dvt_hyperhomocysteinemia","x_risk_factors_of_dvt_cvi",
           "x_risk_factors_of_dvt_history_of_vte","x_risk_factors_of_dvt_pregnancy",
           "x_risk_factors_of_dvt_thrombophilia","x_risk_factors_of_dvt_chronic_kidney_disease",
           "x_risk_factors_of_dvt_oral_contraceptive","x_risk_factors_of_dvt_family_history_of_dvt" ,
           "x_risk_factors_of_dvt_unprovoked","x_comorbidity_hypertension","x_comorbidity_pe",
           "x_comorbidity_stroke","x_comorbidity_diabetes","x_comorbidity_coronary_heart_disease",
           "x_comorbidity_immune_rheumatism","x_types_of_anticoagulants_lmwh","x_types_of_anticoagulants_doacs",                 
           "x_types_of_anticoagulants_vka","x_types_of_anticoagulants_other",
           "x_duration_of_compression_therapy_xiaoyu_6_mon",
           "y_post_thrombotic_syndrome","s_group")] <- lapply(
             mydata2[,c("type", "f_education","x_sex", "x_smoking","x_side_of_dvt_left",
                        "x_side_of_dvt_bilateral","x_symptom_pain","x_symptom_edema","x_symptom_pain_on_calf_compression",
                        "x_ilio_femoral_dvt","x_risk_factors_of_dvt_surgery_and_immobilization",
                        "x_risk_factors_of_dvt_fracture","x_risk_factors_of_dvt_active_cancer",
                        "x_risk_factors_of_dvt_hyperhomocysteinemia","x_risk_factors_of_dvt_cvi",
                        "x_risk_factors_of_dvt_history_of_vte","x_risk_factors_of_dvt_pregnancy",
                        "x_risk_factors_of_dvt_thrombophilia","x_risk_factors_of_dvt_chronic_kidney_disease",
                        "x_risk_factors_of_dvt_oral_contraceptive","x_risk_factors_of_dvt_family_history_of_dvt" ,
                        "x_risk_factors_of_dvt_unprovoked","x_comorbidity_hypertension","x_comorbidity_pe",
                        "x_comorbidity_stroke","x_comorbidity_diabetes","x_comorbidity_coronary_heart_disease",
                        "x_comorbidity_immune_rheumatism","x_types_of_anticoagulants_lmwh","x_types_of_anticoagulants_doacs",                 
                        "x_types_of_anticoagulants_vka","x_types_of_anticoagulants_other",
                        "x_duration_of_compression_therapy_xiaoyu_6_mon",
                        "y_post_thrombotic_syndrome","s_group")], factor)


# gtsummary 生成
tbl_summary(data = mydata2,
            statistic = list(
              # 分别对应数值型和分类变量 后是需要显示表达式
              all_continuous() ~ "{mean}({sd})    {median}({p25}, {p75})",
              # 样本是加权倒置n也是加权的 下面参数是显示
              all_categorical() ~ "{n} ({p}%)"
            ),
            digits = list(all_continuous() ~ 2,all_categorical() ~ 3)
            )







#方法2 
#有点类似tableby 还不是很清楚method为什么加上去了就显示这个均值和 四分位数
table1<-descrTable(~ uid+type+x_age+f_education+x_sex+x_bmi+x_smoking+x_side_of_dvt_left+x_side_of_dvt_bilateral+
                     x_symptom_pain+x_symptom_edema+x_symptom_pain_on_calf_compression+x_ilio_femoral_dvt+
                     x_risk_factors_of_dvt_surgery_and_immobilization+x_risk_factors_of_dvt_fracture+x_risk_factors_of_dvt_active_cancer+
                     x_risk_factors_of_dvt_hyperhomocysteinemia+x_risk_factors_of_dvt_cvi+x_risk_factors_of_dvt_history_of_vte+x_risk_factors_of_dvt_pregnancy+
                     x_risk_factors_of_dvt_thrombophilia+x_risk_factors_of_dvt_chronic_kidney_disease+x_risk_factors_of_dvt_oral_contraceptive+x_risk_factors_of_dvt_family_history_of_dvt+
                     x_risk_factors_of_dvt_unprovoked+x_comorbidity_hypertension+x_comorbidity_pe+x_comorbidity_stroke+x_comorbidity_diabetes+
                     x_comorbidity_coronary_heart_disease+x_comorbidity_immune_rheumatism+x_types_of_anticoagulants_lmwh+x_types_of_anticoagulants_doacs+
                     x_types_of_anticoagulants_vka+x_types_of_anticoagulants_other+x_duration_of_compression_therapy_xiaoyu_6_mon+x_d_dimmer+
                     y_post_thrombotic_syndrome+s_group,data = data
                   
                   ,method = c(uid=NA,type=NA,x_age=NA,f_education=NA,x_sex=NA,x_bmi=NA,x_smoking=NA,x_side_of_dvt_left=NA,
                              x_side_of_dvt_bilateral=NA,x_symptom_pain=NA,x_symptom_edema=NA,x_symptom_pain_on_calf_compression=NA,
                              x_ilio_femoral_dvt=NA,x_risk_factors_of_dvt_surgery_and_immobilization=NA,x_risk_factors_of_dvt_fracture=NA,
                              x_risk_factors_of_dvt_active_cancer=NA,x_risk_factors_of_dvt_hyperhomocysteinemia=NA,x_risk_factors_of_dvt_cvi=NA,
                              x_risk_factors_of_dvt_history_of_vte=NA,x_risk_factors_of_dvt_pregnancy=NA,x_risk_factors_of_dvt_thrombophilia=NA,
                              x_risk_factors_of_dvt_chronic_kidney_disease=NA,x_risk_factors_of_dvt_oral_contraceptive=NA,x_risk_factors_of_dvt_family_history_of_dvt=NA,
                              x_risk_factors_of_dvt_unprovoked=NA,x_comorbidity_hypertension=NA,x_comorbidity_pe=NA,x_comorbidity_stroke=NA,x_comorbidity_diabetes=NA,
                              x_comorbidity_coronary_heart_disease=NA,x_comorbidity_immune_rheumatism=NA,x_types_of_anticoagulants_lmwh=NA,x_types_of_anticoagulants_doacs=NA,
                              x_types_of_anticoagulants_vka=NA,x_types_of_anticoagulants_other=NA,x_duration_of_compression_therapy_xiaoyu_6_mon=NA,x_d_dimmer=NA,
                              y_post_thrombotic_syndrome=NA,s_group=NA)
                   )
table1


#基线2
mydata <- data

# 意思是在原来表提取字段后把第一列的列名换成group 可以使用 colnames(dfxorg)[1] <- 'group' 一句完成
dfx = mydata %>% select(y_post_thrombotic_syndrome,x_age,f_education,x_sex,x_bmi,x_smoking,x_side_of_dvt_left,x_side_of_dvt_bilateral,x_symptom_pain,x_symptom_edema,x_symptom_pain_on_calf_compression,x_ilio_femoral_dvt,x_risk_factors_of_dvt_surgery_and_immobilization,x_risk_factors_of_dvt_fracture,x_risk_factors_of_dvt_active_cancer,x_risk_factors_of_dvt_hyperhomocysteinemia,x_risk_factors_of_dvt_cvi,x_risk_factors_of_dvt_history_of_vte,x_risk_factors_of_dvt_pregnancy,x_risk_factors_of_dvt_thrombophilia,x_risk_factors_of_dvt_chronic_kidney_disease,x_risk_factors_of_dvt_oral_contraceptive,x_risk_factors_of_dvt_family_history_of_dvt,x_risk_factors_of_dvt_unprovoked,x_comorbidity_hypertension,x_comorbidity_pe,x_comorbidity_stroke,x_comorbidity_diabetes,x_comorbidity_coronary_heart_disease,x_comorbidity_immune_rheumatism,x_types_of_anticoagulants_lmwh,x_types_of_anticoagulants_doacs,x_types_of_anticoagulants_vka,x_types_of_anticoagulants_other,x_duration_of_compression_therapy_xiaoyu_6_mon,x_d_dimmer) %>% dplyr::rename("group"=1)
colnames(dfx)
dfxorg <-mydata %>% select(y_post_thrombotic_syndrome,x_age,f_education,x_sex,x_bmi,x_smoking,x_side_of_dvt_left,x_side_of_dvt_bilateral,x_symptom_pain,x_symptom_edema,x_symptom_pain_on_calf_compression,x_ilio_femoral_dvt,x_risk_factors_of_dvt_surgery_and_immobilization,x_risk_factors_of_dvt_fracture,x_risk_factors_of_dvt_active_cancer,x_risk_factors_of_dvt_hyperhomocysteinemia,x_risk_factors_of_dvt_cvi,x_risk_factors_of_dvt_history_of_vte,x_risk_factors_of_dvt_pregnancy,x_risk_factors_of_dvt_thrombophilia,x_risk_factors_of_dvt_chronic_kidney_disease,x_risk_factors_of_dvt_oral_contraceptive,x_risk_factors_of_dvt_family_history_of_dvt,x_risk_factors_of_dvt_unprovoked,x_comorbidity_hypertension,x_comorbidity_pe,x_comorbidity_stroke,x_comorbidity_diabetes,x_comorbidity_coronary_heart_disease,x_comorbidity_immune_rheumatism,x_types_of_anticoagulants_lmwh,x_types_of_anticoagulants_doacs,x_types_of_anticoagulants_vka,x_types_of_anticoagulants_other,x_duration_of_compression_therapy_xiaoyu_6_mon,x_d_dimmer)
colnames(dfxorg)
colnames(dfxorg)[1] <- 'group'
colnames(dfxorg)
mydata[,'y_post_thrombotic_syndrome']
dfx[,"group"]

mean(dfx[,'x_d_dimmer'])



dfx[,'x_smoking']

descrTable(group~.,data = dfx,method = 5,show.all=TRUE)
descrTable(group~.,data = dfx,method = 4,show.all=TRUE)
descrTable(group~.,data = dfx,method = 3,show.all=TRUE)
descrTable(group~.,data = dfx,method = 2,show.all=TRUE)
table2 <- descrTable(group~.,data = dfx, method = c(x_age=NA,f_education=NA,x_sex=NA,x_bmi=NA,x_smoking=NA,x_side_of_dvt_left=NA,x_side_of_dvt_bilateral=NA,x_symptom_pain=NA,x_symptom_edema=NA,x_symptom_pain_on_calf_compression=NA,x_ilio_femoral_dvt=NA,x_risk_factors_of_dvt_surgery_and_immobilization=NA,x_risk_factors_of_dvt_fracture=NA,x_risk_factors_of_dvt_active_cancer=NA,x_risk_factors_of_dvt_hyperhomocysteinemia=NA,x_risk_factors_of_dvt_cvi=NA,x_risk_factors_of_dvt_history_of_vte=NA,x_risk_factors_of_dvt_pregnancy=NA,x_risk_factors_of_dvt_thrombophilia=NA,x_risk_factors_of_dvt_chronic_kidney_disease=NA,x_risk_factors_of_dvt_oral_contraceptive=NA,x_risk_factors_of_dvt_family_history_of_dvt=NA,x_risk_factors_of_dvt_unprovoked=NA,x_comorbidity_hypertension=NA,x_comorbidity_pe=NA,x_comorbidity_stroke=NA,x_comorbidity_diabetes=NA,x_comorbidity_coronary_heart_disease=NA,x_comorbidity_immune_rheumatism=NA,x_types_of_anticoagulants_lmwh=NA,x_types_of_anticoagulants_doacs=NA,x_types_of_anticoagulants_vka=NA,x_types_of_anticoagulants_other=NA,x_duration_of_compression_therapy_xiaoyu_6_mon=NA,x_d_dimmer=NA),show.all=TRUE)


table2
rbdata <- rbind(train,test)

dfx = rbdata %>% select(y_post_thrombotic_syndrome,x_age,f_education,x_sex,x_bmi,x_smoking,x_side_of_dvt_left,x_side_of_dvt_bilateral,x_symptom_pain,x_symptom_edema,x_symptom_pain_on_calf_compression,x_ilio_femoral_dvt,x_risk_factors_of_dvt_surgery_and_immobilization,x_risk_factors_of_dvt_fracture,x_risk_factors_of_dvt_active_cancer,x_risk_factors_of_dvt_hyperhomocysteinemia,x_risk_factors_of_dvt_cvi,x_risk_factors_of_dvt_history_of_vte,x_risk_factors_of_dvt_pregnancy,x_risk_factors_of_dvt_thrombophilia,x_risk_factors_of_dvt_chronic_kidney_disease,x_risk_factors_of_dvt_oral_contraceptive,x_risk_factors_of_dvt_family_history_of_dvt,x_risk_factors_of_dvt_unprovoked,x_comorbidity_hypertension,x_comorbidity_pe,x_comorbidity_stroke,x_comorbidity_diabetes,x_comorbidity_coronary_heart_disease,x_comorbidity_immune_rheumatism,x_types_of_anticoagulants_lmwh,x_types_of_anticoagulants_doacs,x_types_of_anticoagulants_vka,x_types_of_anticoagulants_other,x_duration_of_compression_therapy_xiaoyu_6_mon,x_d_dimmer,Groupsp) %>% dplyr::rename("group"=1) %>% mutate(Groupsp=factor(Groupsp))
table3<-descrTable(Groupsp~.,data = dfx,method = c(x_age=NA,f_education=NA,x_sex=NA,x_bmi=NA,x_smoking=NA,x_side_of_dvt_left=NA,x_side_of_dvt_bilateral=NA,x_symptom_pain=NA,x_symptom_edema=NA,x_symptom_pain_on_calf_compression=NA,x_ilio_femoral_dvt=NA,x_risk_factors_of_dvt_surgery_and_immobilization=NA,x_risk_factors_of_dvt_fracture=NA,x_risk_factors_of_dvt_active_cancer=NA,x_risk_factors_of_dvt_hyperhomocysteinemia=NA,x_risk_factors_of_dvt_cvi=NA,x_risk_factors_of_dvt_history_of_vte=NA,x_risk_factors_of_dvt_pregnancy=NA,x_risk_factors_of_dvt_thrombophilia=NA,x_risk_factors_of_dvt_chronic_kidney_disease=NA,x_risk_factors_of_dvt_oral_contraceptive=NA,x_risk_factors_of_dvt_family_history_of_dvt=NA,x_risk_factors_of_dvt_unprovoked=NA,x_comorbidity_hypertension=NA,x_comorbidity_pe=NA,x_comorbidity_stroke=NA,x_comorbidity_diabetes=NA,x_comorbidity_coronary_heart_disease=NA,x_comorbidity_immune_rheumatism=NA,x_types_of_anticoagulants_lmwh=NA,x_types_of_anticoagulants_doacs=NA,x_types_of_anticoagulants_vka=NA,x_types_of_anticoagulants_other=NA,x_duration_of_compression_therapy_xiaoyu_6_mon=NA,x_d_dimmer=NA),show.all=TRUE)
table3


dfx = dev %>% select(y_post_thrombotic_syndrome,x_age,f_education,x_sex,x_bmi,x_smoking,x_side_of_dvt_left,x_side_of_dvt_bilateral,x_symptom_pain,x_symptom_edema,x_symptom_pain_on_calf_compression,x_ilio_femoral_dvt,x_risk_factors_of_dvt_surgery_and_immobilization,x_risk_factors_of_dvt_fracture,x_risk_factors_of_dvt_active_cancer,x_risk_factors_of_dvt_hyperhomocysteinemia,x_risk_factors_of_dvt_cvi,x_risk_factors_of_dvt_history_of_vte,x_risk_factors_of_dvt_pregnancy,x_risk_factors_of_dvt_thrombophilia,x_risk_factors_of_dvt_chronic_kidney_disease,x_risk_factors_of_dvt_oral_contraceptive,x_risk_factors_of_dvt_family_history_of_dvt,x_risk_factors_of_dvt_unprovoked,x_comorbidity_hypertension,x_comorbidity_pe,x_comorbidity_stroke,x_comorbidity_diabetes,x_comorbidity_coronary_heart_disease,x_comorbidity_immune_rheumatism,x_types_of_anticoagulants_lmwh,x_types_of_anticoagulants_doacs,x_types_of_anticoagulants_vka,x_types_of_anticoagulants_other,x_duration_of_compression_therapy_xiaoyu_6_mon,x_d_dimmer) %>% dplyr::rename("group"=1)
table4<-descrTable(group~.,data = dfx,method = c(x_age=NA,f_education=NA,x_sex=NA,x_bmi=NA,x_smoking=NA,x_side_of_dvt_left=NA,x_side_of_dvt_bilateral=NA,x_symptom_pain=NA,x_symptom_edema=NA,x_symptom_pain_on_calf_compression=NA,x_ilio_femoral_dvt=NA,x_risk_factors_of_dvt_surgery_and_immobilization=NA,x_risk_factors_of_dvt_fracture=NA,x_risk_factors_of_dvt_active_cancer=NA,x_risk_factors_of_dvt_hyperhomocysteinemia=NA,x_risk_factors_of_dvt_cvi=NA,x_risk_factors_of_dvt_history_of_vte=NA,x_risk_factors_of_dvt_pregnancy=NA,x_risk_factors_of_dvt_thrombophilia=NA,x_risk_factors_of_dvt_chronic_kidney_disease=NA,x_risk_factors_of_dvt_oral_contraceptive=NA,x_risk_factors_of_dvt_family_history_of_dvt=NA,x_risk_factors_of_dvt_unprovoked=NA,x_comorbidity_hypertension=NA,x_comorbidity_pe=NA,x_comorbidity_stroke=NA,x_comorbidity_diabetes=NA,x_comorbidity_coronary_heart_disease=NA,x_comorbidity_immune_rheumatism=NA,x_types_of_anticoagulants_lmwh=NA,x_types_of_anticoagulants_doacs=NA,x_types_of_anticoagulants_vka=NA,x_types_of_anticoagulants_other=NA,x_duration_of_compression_therapy_xiaoyu_6_mon=NA,x_d_dimmer=NA),show.all=TRUE)
sink("logit_baseline4.txt")
table4
sink()
export2xls(table4,file = "logit_baseline4.xls")


dfx = vad %>% select(y_post_thrombotic_syndrome,x_age,f_education,x_sex,x_bmi,x_smoking,x_side_of_dvt_left,x_side_of_dvt_bilateral,x_symptom_pain,x_symptom_edema,x_symptom_pain_on_calf_compression,x_ilio_femoral_dvt,x_risk_factors_of_dvt_surgery_and_immobilization,x_risk_factors_of_dvt_fracture,x_risk_factors_of_dvt_active_cancer,x_risk_factors_of_dvt_hyperhomocysteinemia,x_risk_factors_of_dvt_cvi,x_risk_factors_of_dvt_history_of_vte,x_risk_factors_of_dvt_pregnancy,x_risk_factors_of_dvt_thrombophilia,x_risk_factors_of_dvt_chronic_kidney_disease,x_risk_factors_of_dvt_oral_contraceptive,x_risk_factors_of_dvt_family_history_of_dvt,x_risk_factors_of_dvt_unprovoked,x_comorbidity_hypertension,x_comorbidity_pe,x_comorbidity_stroke,x_comorbidity_diabetes,x_comorbidity_coronary_heart_disease,x_comorbidity_immune_rheumatism,x_types_of_anticoagulants_lmwh,x_types_of_anticoagulants_doacs,x_types_of_anticoagulants_vka,x_types_of_anticoagulants_other,x_duration_of_compression_therapy_xiaoyu_6_mon,x_d_dimmer) %>% dplyr::rename("group"=1)
table5<-descrTable(group~.,data = dfx,method = c(x_age=NA,f_education=NA,x_sex=NA,x_bmi=NA,x_smoking=NA,x_side_of_dvt_left=NA,x_side_of_dvt_bilateral=NA,x_symptom_pain=NA,x_symptom_edema=NA,x_symptom_pain_on_calf_compression=NA,x_ilio_femoral_dvt=NA,x_risk_factors_of_dvt_surgery_and_immobilization=NA,x_risk_factors_of_dvt_fracture=NA,x_risk_factors_of_dvt_active_cancer=NA,x_risk_factors_of_dvt_hyperhomocysteinemia=NA,x_risk_factors_of_dvt_cvi=NA,x_risk_factors_of_dvt_history_of_vte=NA,x_risk_factors_of_dvt_pregnancy=NA,x_risk_factors_of_dvt_thrombophilia=NA,x_risk_factors_of_dvt_chronic_kidney_disease=NA,x_risk_factors_of_dvt_oral_contraceptive=NA,x_risk_factors_of_dvt_family_history_of_dvt=NA,x_risk_factors_of_dvt_unprovoked=NA,x_comorbidity_hypertension=NA,x_comorbidity_pe=NA,x_comorbidity_stroke=NA,x_comorbidity_diabetes=NA,x_comorbidity_coronary_heart_disease=NA,x_comorbidity_immune_rheumatism=NA,x_types_of_anticoagulants_lmwh=NA,x_types_of_anticoagulants_doacs=NA,x_types_of_anticoagulants_vka=NA,x_types_of_anticoagulants_other=NA,x_duration_of_compression_therapy_xiaoyu_6_mon=NA,x_d_dimmer=NA),show.all=TRUE)
table5

# 
#### 临床模型工具箱 下面是差异性分析 ####


